/*
 *  vectorLinesScene.h
 *  opencvExample
 *
 *  Created by 真鍋 大度 on 11/03/01.
 *  Copyright 2011 Rhizomatiks. All rights reserved.
 *
 */


#pragma once
#include "ofMain.h"
#include "basePattern.h"

class vectorLinesScene : public basePattern{
public:
	void setup(){
		allocate();
		xGap = 20;		
		for (int i = 0; i < h; i++){
			for (int j = 0; j < w; j++){
				unsigned char tmpval = j % xGap== 0  || j == w - 1 ? maxGray : 0;
				currentColorPixels[(i*w+j)*3 + 0] = tmpval;
				currentColorPixels[(i*w+j)*3 + 1] = tmpval;
				currentColorPixels[(i*w+j)*3 + 2] = tmpval;		
			}
		}
	}
	void update(){
		currentColorImage.setFromPixels(currentColorPixels, w, h);	
		count++;
//		if (count % ((int)ofGetFrameRate() * 10) == 0) {
		if (count % 45 == 0) {			
			xGap += 10;
			if (xGap > 50) {
				xGap = 20;
			}
		}
	}
	void setupWhenPatternChanged(){
		count = 0;
	}
	int count;
	int xGap;	
};